# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.DiscoveryEngine.V1.Model.GoogleCloudDiscoveryengineV1Chunk do
  @moduledoc """
  Chunk captures all raw metadata information of items to be recommended or searched in the chunk mode.

  ## Attributes

  *   `chunkMetadata` (*type:* `GoogleApi.DiscoveryEngine.V1.Model.GoogleCloudDiscoveryengineV1ChunkChunkMetadata.t`, *default:* `nil`) - Output only. Metadata of the current chunk.
  *   `content` (*type:* `String.t`, *default:* `nil`) - Content is a string from a document (parsed content).
  *   `derivedStructData` (*type:* `map()`, *default:* `nil`) - Output only. This field is OUTPUT_ONLY. It contains derived data that are not in the original input document.
  *   `documentMetadata` (*type:* `GoogleApi.DiscoveryEngine.V1.Model.GoogleCloudDiscoveryengineV1ChunkDocumentMetadata.t`, *default:* `nil`) - Metadata of the document from the current chunk.
  *   `id` (*type:* `String.t`, *default:* `nil`) - Unique chunk ID of the current chunk.
  *   `name` (*type:* `String.t`, *default:* `nil`) - The full resource name of the chunk. Format: `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/branches/{branch}/documents/{document_id}/chunks/{chunk_id}`. This field must be a UTF-8 encoded string with a length limit of 1024 characters.
  *   `pageSpan` (*type:* `GoogleApi.DiscoveryEngine.V1.Model.GoogleCloudDiscoveryengineV1ChunkPageSpan.t`, *default:* `nil`) - Page span of the chunk.
  *   `relevanceScore` (*type:* `float()`, *default:* `nil`) - Output only. Represents the relevance score based on similarity. Higher score indicates higher chunk relevance. The score is in range [-1.0, 1.0]. Only populated on SearchResponse.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :chunkMetadata =>
            GoogleApi.DiscoveryEngine.V1.Model.GoogleCloudDiscoveryengineV1ChunkChunkMetadata.t()
            | nil,
          :content => String.t() | nil,
          :derivedStructData => map() | nil,
          :documentMetadata =>
            GoogleApi.DiscoveryEngine.V1.Model.GoogleCloudDiscoveryengineV1ChunkDocumentMetadata.t()
            | nil,
          :id => String.t() | nil,
          :name => String.t() | nil,
          :pageSpan =>
            GoogleApi.DiscoveryEngine.V1.Model.GoogleCloudDiscoveryengineV1ChunkPageSpan.t() | nil,
          :relevanceScore => float() | nil
        }

  field(:chunkMetadata,
    as: GoogleApi.DiscoveryEngine.V1.Model.GoogleCloudDiscoveryengineV1ChunkChunkMetadata
  )

  field(:content)
  field(:derivedStructData, type: :map)

  field(:documentMetadata,
    as: GoogleApi.DiscoveryEngine.V1.Model.GoogleCloudDiscoveryengineV1ChunkDocumentMetadata
  )

  field(:id)
  field(:name)

  field(:pageSpan,
    as: GoogleApi.DiscoveryEngine.V1.Model.GoogleCloudDiscoveryengineV1ChunkPageSpan
  )

  field(:relevanceScore)
end

defimpl Poison.Decoder, for: GoogleApi.DiscoveryEngine.V1.Model.GoogleCloudDiscoveryengineV1Chunk do
  def decode(value, options) do
    GoogleApi.DiscoveryEngine.V1.Model.GoogleCloudDiscoveryengineV1Chunk.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.DiscoveryEngine.V1.Model.GoogleCloudDiscoveryengineV1Chunk do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
